use Mydb

Create Table HAT_UserAccounts(
UserID int identity(1,1) primary key not null,
UserName varchar(30) not null,
Password varchar(30) not null,
DOB datetime not null,
EMailAddr varchar(50) not null,
SecretQuestion varchar(50) not null,
SecretAnswer varchar(50) not null,
LastLogin datetime null,
IsApproved bit default 0)

Alter Table HAT_UserAccounts
add constraint DF_HAT_UserAccounts_EmailAddr default 'user@domain.com'

Create Table HAT_UserRoles(
UserID int not null,
Role varchar(20) not null)
--
Alter table HAT_UserRoles
Add constraint HAT_UserRoles_FK_UserID foreign key(UserID)
references HAT_UserAccounts(UserID)
on update no action
on delete no action

Create Table HAT_ExpenseHead(
HeadID int not null identity(1,1),
ExpenseHead varchar(30) not null primary key)*/

Create Table HAT_Expenses(
ExpenseDate datetime not null,
PaidBy varchar(30) not null,
ForPeriod varchar(30) not null,
ExpenseHead varchar(30) not null,
ExpenseDesc varchar(max),
ExpenseAmount bigint not null,
ExpenseID bigint identity(1,1) not null primary key)

Create Table HAT_Income(
IncomeID bigint identity(1,1) not null primary Key,
IncomeDate datetime not null,
ExpenseHead varchar(30) not null,
PaidBy varchar(30) not null,
ForPeriod varchar(30) not null,
IncNotes varchar(MAX) not null,
IncomeAmount numeric(18,2) not null)

--Creating unique nonClustered Key for UserName's
Create Unique nonclustered index HAT_UserAccounts_UK_UserName on HAT_UserAccounts(
UserName)

Alter table HAT_UserAccounts
Add FirstName varchar(30) default 'FirstName'

Alter table HAT_UserAccounts
Add LastName varchar(30) default 'LastName'

Alter table HAT_UserAccounts
Add DisplayName varchar(50) default 'DisplayName'

Create Unique nonclustered index HAT_UserAccounts_UK_DisplayName on HAT_UserAccounts(DisplayName)

Alter Table HAT_UserAccounts
add ForcedPasswordChange bit default false

Alter Table HAT_UserAccounts
add ForcePasswordChangedDate datetime null

Create Table HAT_OverAllExp(
ExpID primary key not null,
PaidBy varchar(30) not null,
ForPeriod varchar(30) not null,
ExpenseHead varchar(30) not null,
ExpenseAmount numeric(18,2) not null,
IncomeAmount numeric(18,2) not null,
DiffAmount numeric(18,2) not null,
Tallyed bit not null,
Comments varchar(max) null)